package com.noah.common.trace.config.auto;

import com.noah.common.trace.interceptor.TraceInterceptor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author noah
 * 2023/9/13 19:18
 */
@AutoConfiguration
@ComponentScan(basePackages = {"com.noah.common.trace"})
public class TraceAutoConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TraceInterceptor()).addPathPatterns("/**");
    }
}
